<?php
class Page_MenuController extends XPHP_Controller
{
	public function viewAction()
	{
	}
	#[Authorize(roles = 'Administrator')]
	public function createAction()
	{
		$model = new Areas_Page_Models_Page();
        //Lấy ra danh sách danh mục theo dạng cây
        $pages = $model->getPages();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($pages as $p) {
            $options[$this->url->action('index', 'Index', 'Page', array($p->id))] = $p->title;
        }
        //Assign sang view
        $this->view->pageOptions = $options;
        
		return $this->view();
	}
	#[Authorize(roles = 'Administrator')]
	public function editAction()
	{
		$model = new Areas_Page_Models_Page();
        //Lấy ra danh sách danh mục theo dạng cây
        $pages = $model->getPages();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($pages as $p) {
            $options[$this->url->action('index', 'Index', 'Page', array($p->id))] = $p->title;
        }
        //Assign sang view
        $this->view->pageOptions = $options;
        
        //Value
        $this->view->value = $this->url->action('index', 'Index', 'Page', array($this->params[0]));
		return $this->view();
	}
}